
<%@page import="classes.Reports"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
        <link rel="stylesheet" href="../css/table.css" type="text/css" />

        <title>Stock List</title>
    </head>
    <body>
        <table id="table-1">
	<thead>
		<th>Stock Symbol</th>
		<th>Company Name</th>
                <th>Price Per Share</th>
		<th>Number of Shares</th>
	</thead>
	<tbody>
	<%
            JavaBeans.User user = (JavaBeans.User) session.getAttribute("user");
            Reports.getConnection("SELECT S.StockSymbol, S.CompanyName, O.PricePerShare, O.NumShares FROM `brchung`.`stock` S,  `brchung`.`order1` O, `brchung`.`trade` T, `brchung`.`account` A WHERE A.Id = T.AccountId AND T.StockId=S.StockSymbol AND A.Client='"+ user.getSsn() +"'  AND T.OrderID = O.id");
            ArrayList<String[]> rs=Reports.getResults(1,2,3,4);
            for(int i=0;i<rs.size();i++){
                out.print("<tr>");
                for(int j=0;j<4;j++)
                    out.print("<td>"+rs.get(i)[j]+"</td>");
                out.print("</tr>");
            }
        %>
	</tbody>
    </table>
    </body>
</html>